<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>lchown</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_000_007_299">&nbsp;</a>NAME</h4><blockquote>
lchown - change the owner and group of a symbolic link
</blockquote><h4><a name = "tag_000_007_300">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="unistd.h.html">unistd.h</a>&gt;

int lchown(const char *<i>path</i>, uid_t <i>owner</i>, gid_t <i>group</i>);
</code>
</pre>
</blockquote><h4><a name = "tag_000_007_301">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>lchown()</i>
function has the same effect as
<i><a href="chown.html">chown()</a></i>
except in the case where the named file is a symbolic link.  In this case
<i>lchown()</i>
changes the ownership of the symbolic link file itself, while
<i><a href="chown.html">chown()</a></i>
changes the ownership of the file or directory to which the symbolic link
refers.
</blockquote><h4><a name = "tag_000_007_302">&nbsp;</a>RETURN VALUE</h4><blockquote>
Upon successful completion,
<i>lchown()</i>
returns 0.  Otherwise, it returns
-1 and sets <i>errno</i> to indicate an error.
</blockquote><h4><a name = "tag_000_007_303">&nbsp;</a>ERRORS</h4><blockquote>
The
<i>lchown()</i>
function will fail if:
<dl compact>

<dt>[EACCES]<dd>
Search permission is denied on a component of the path prefix of
<i>path</i>.

<dt>[EINVAL]<dd>
The owner or group id is not a value supported by the implementation.

<dt>[ENAMETOOLONG]<dd>

The length of a pathname exceeds {PATH_MAX}, or pathname
component is longer than {NAME_MAX}.

<dt>[ENOENT]<dd>
A component of <i>path</i> does not name an existing file
or <i>path</i> is an empty string.

<dt>[ENOTDIR]<dd>
A component of the path prefix of <i>path</i> is not a directory.

<dt>[EOPNOTSUPP]<dd>
The <i>path</i> argument names a symbolic link and the implementation
does not support setting the owner or group of a symbolic link.

<dt>[ELOOP]<dd>
Too many symbolic links were encountered in resolving <i>path</i>.

<dt>[EPERM]<dd>
The effective user ID does not match the owner of the file and the
process does not have appropriate privileges.

<dt>[EROFS]<dd>
The file resides on a read-only file system.

</dl>
<p>
The
<i>lchown()</i>
function may fail if:
<dl compact>

<dt>[EIO]<dd>
An I/O error occurred while reading or writing to the file system.

<dt>[EINTR]<dd>
A signal was caught during execution of the function.

<dt>[ENAMETOOLONG]<dd>

Pathname resolution of a symbolic link produced an intermediate result whose
length exceeds {PATH_MAX}.

</dl>
</blockquote><h4><a name = "tag_000_007_304">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_007_305">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_007_306">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_007_307">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="chown.html">chown()</a></i>,
<i><a href="symlink.html">symlink()</a></i>,
<i><a href="unistd.h.html">&lt;unistd.h&gt;</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
